<?php
function ajax_return($status,$message)
{
	$data = array('status'=>$status,'message'=>$message);
	return json_encode($data,JSON_UNESCAPED_UNICODE);
}
if(isset($_GET['mid'])&&$_GET['mid'])
{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, 'http://192.168.253.3/wzr/enroll.php');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	$result = curl_exec($ch);	
	curl_close($ch);
	echo $result;	
	if(!$result)
		echo ajax_return(0,"failed");
	else
	{	
		$data=json_decode($result,1);
		print_r($data);

		//echo '</br></br>';
		if($data['status']!=0)
		{
			echo  ajax_return(0,"failed");
			return ;
		}
		//$connect = new mysqli('192.168.253.3','root','','ylg');		
		$connect = new mysqli('localhost','root','','ylg');		
		if ($connect->connect_error) {  
        	die("连接失败: " . $connect->connect_error);          
    	}	 	 
    	$sql = "UPDATE  `ylg`.`member` SET  `fingerprint` =  '{$data['id']}',`fingerprint_pic` =  'ffdasd' WHERE  `member`.`mid` ={$_GET['mid']}";
		$results = $connect->query($sql);  		
    	if ($results)
        	echo  ajax_return(1,"failed");
    	else 
        	echo ajax_return(0,"failed");   		
	}
}
else
	echo ajax_return(0,"failed");

?>